/* Copyright 2012 Dustin Mitchell <dmmitche [at] gmail [dot] com>
 *
 * Licensed under the GPLv3.  See included LICENSE.txt for full details.
 */

#ifndef __MESSAGES__
#define __MESSAGES__

#include <sys/time.h>

#include "sensor.h"

#define QUIT_MESSAGE 0
#define SENSOR_MESSAGE 1

struct message_header
{
  int type;
  struct timeval ts;
};

struct quit_message
{
  struct message_header header;
};

struct sensor_message
{
  struct message_header header;
  int sensor_id;
  union sensor_reading reading;
};

union message
{
  struct message_header header;
  struct quit_message quit;
  struct sensor_message sensor;
};

#endif /* __MESSAGES__ */
